import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)
//1.导入组件
import login from '@/views/user/login.vue'
import index from '@/views/home/index.vue'
import articleCategory from '@/views/article/articleCategory.vue'
import articleList from '@/views/article/articleList.vue'
import articleRelease from '@/views/article/articleRelease.vue'
import comment from '@/views/comment/comment.vue'
import mainCount from '@/views/home/mainCount.vue'
import user from '@/views/user/user.vue'

//2.设置路由规则
const routes = [{
    name: 'login',
    path: '/login',
    component: login
  },
  {
    name: 'index',
    path: '/index',
    component: index,
    children: [{
        name: 'articleCategory',
        path: '/articleCategory',
        component: articleCategory
      },
      {
        name: 'articleList',
        path: '/articleList',
        component: articleList
      },
      {
        name: 'articleRelease',
        path: '/articleRelease',
        component: articleRelease
      },
      {
        name: 'comment',
        path: '/comment',
        component: comment
      },
      {
        name: 'mainCount',
        path: '/mainCount',
        component: mainCount
      },
      {
        name: 'user',
        path: '/user',
        component: user
      }, , {
        path: '/',
        redirect: '/mainCount'
      }

    ]
  }, {
    path: '/',
    redirect: '/index'
  }

]
//3.创建路由对象
const router = new VueRouter({
  routes
})
//4.导出,挂载到vue实例
export default router
